package com.response;

import lombok.Getter;

/**
 * 响应码枚举，参考HTTP状态码的语义
 */
@Getter
public enum ErrorCode {
    SUCCESS(200, "成功"),//成功
    FAIL(400, "失败"),//失败
    UNAUTHORIZED(401, "未认证"),//未认证（签名错误）
    NOT_FOUND(404, "接口不存在"),//接口不存在
    INTERNAL_SERVER_ERROR(500, "服务器异常"),//服务器异常

    HTTP_MESSAGE_NOT_READABLE(1001, "参数错误"),
    PHONE_NOT_EXIST(1002, "手机号不存在"),
    CODE_ERROR(1003, "验证码错误"),
    CREATE_TOKEN_ERROR(1004, "生成token失败"),
    TOKEN_EXPIRE(1005, "token过期"),
    TOKEN_INVALID(1006, "token无效"),
    ACCOUNT_NOT_OPEN(1007, "该账号未开通"),
    INVITE_CODE_ERROR(1008, "邀请码错误"),
    CASHIER_DESK_NAME_EXISTS(1009, "收银机名已存在"),
    LOGIN_ERROR(1010, "账号或密码错误"),
    FIRST_LOGIN(1011, "第一次登录"),
    DEVICE_ID_NOT_EXIST(1012, "用户在其他设备登录"),
    PHONE_INVITE_CODE_BOTH_EMPTY(1013, "账号验证失败"),
    SIGN_ERROR(1014,"签名错误"),
    MACHINE_ERROR(1015,"机器未绑定"),


    UPLOAD_ERROR(2006, "上传人脸图片失败"),
    FACE_IDENTIFY(2001, "人脸认证失败"),
    FACE_IDENTIFY_29(2007, "该人脸未绑定实体卡"),
    CUSTOMER_NOT_EXIST(2002, "顾客不存在"),
    PERSON_EXISTS(2003, "个体已经存在"),
    SHOP_NOT_EXISTS(2004, "商户不存在"),
    SHOP_WAIT_EXISTS(2006, "商户等待审核中"),

    DELETE_FACE_ERROR(2005, "删除人脸失败"),


    WX_DECRYPT_ERROR(3000, "userInfo解密失败"),
    WX_BUILD_TOKEN(3001, "生成小程序token失败"),
    WX_CREATE_CUSTOMER(3002, "创建小程序用户"),
    WX_CUSTOMER_NOT_EXIST(3003, "小程序用户不存在"),
    WX_PAYCARD_NOT_EXIST(3004, "卡不存在"),
    WX_PAYCARD_IS_EXIST(3005, "卡已存在"),
    WX_ORDER_NOT_EXIST(3006, "订单不存在"),
    WX_REFUND_PAYCARD_ERROR(3007, "退卡失败"),
    PAYCARD_NOT_SUFFICIENT_FUNDS(3008, "卡余额不足"),
    PAYCARD_NOT_HAVE_MASTER(3009, "修改卡失败,必须要有一张主卡"),
    PAYCARD_NOT_CONTRACT(3010, "支付卡没有签约"),
    PAYCARD_PAYCODE_INVALID(3011, "条形码已失效"),
    PAYCARD_PAYCODE_NOT_SUPPORT(3012, "不支持的卡类型"),
    PAYCARD_NOT_AUDIT(3013, "会员未通过审核"),
    PAYCARD_PAYCODE_SHOPID_NOT_SUPPORT(3014, "不是本店会员码"),


    WX_PAY_ERROR(4000, "微信下单失败"),
    ALI_PAY_ERROR(4001, "支付宝下单失败"),
    WX_MICROPAY_ERROR(4002, "微信扫码支付失败"),
    ALI_MICROPAY_ERROR(4003, "支付宝扫码支付失败"),
    WX_CONTRACT_PAY_ERROR(4004, "微信免秘支付失败"),

    ORDER_ITEM_NOT_EXISTS(5000, "商品项不能为空"),
    PRODUCT_NOT_EXISTS(5001, "商品不存在"),

    Order_EXISTS(6001, "订单已存在"),

    YZF_CUSTOMER_ERROR(7000,"不存在该用户"),
    YZF_DATE_ERROR(7001,"日期格式错误"),
    YZF_ORDER_ERROR(7002,"不存在该订单"),
    YZF_ORDER_AMOUNT_ERROR(7003,"订单金额有误"),
    YZF_TXT_ERROR(7004,"翼支付生成TXT出错"),

    YPCARD_EXISTS(8001, "卡芯片号已存在"),
    YPCARDNO_EXISTS(8003, "该店铺下此卡面号已存在"),
    YPCARD_CHECK_ERROR(8002, "校验失败"),
    ORDER_NO_PAY(9000,"订单未支付"),
    CELLS_NOT_ENOUGH(9001,"取餐柜空闲柜格不足"),
    INSERT_OR_UPDATE_ERROR(9002,"插入或新增数据库操作失败"),
    NOT_SHOP_VIP(9003,"非商户会员"),
    SAVE_ORDER_FAIL(9004,"存餐失败"),
    NOT_ENOUGH_SERIAL(9005,"序列号已用光"),
    EXCEPTION_ROLLBACK(9006,"异常触发回滚"),
    GET_PAY_CODE_FAIL(9007,"获取支付二维码失败"),
    DEVICE_NOT_INIT(9008,"设备未初始化"),
    JPUSH_ID_NOT_EXIST(9009,"极光推送id不存在"),
    DATA_NOT_EXIST(9010,"数据不存在"),
    SEND_REQUEST_FAIL(9011,"发送请求失败"),
    SIDE_BOARD_NOT_EXIST(9012,"取餐柜不存在"),
    MEAL_CODE_NOT_EXIST(9013,"取餐码无效"),
    NOT_MEALS(9014,"非存餐订单"),
    CELL_IS_USING(9015,"柜格正在被使用中！"),
    CUSTOMER_NOT_ORDER(9016,"用户无正在存餐中的订单！"),
    MEAL_CODE_ERROR(9017,"取餐码错误！"),
    ORDER_NOT_IN_THIS_BOARD(9018,"订单不在此取餐柜！"),
    URL_ERROR(9019,"url错误"),
    CUSTOMER_NOT_ALLOW_SAVE_ORDER(9020,"用户码不支持存餐"),
    ORDER_DETAIL_NOT_EXISTS(9021,"订单详情地址错误！"),
    WXGZMESSAGE_PUSH_FAIL(9022,"微信公众号订阅消息发送失败,请再次尝试！"),
    SAVE_ORDER_OVER_TIME(9023,"存餐时间超限！"),
    JPUSH_FAIL(9024,"推送失败"),
    SMS_SEND_FAIL(9025,"短信发送失败")

            ;
    public int code;
    private String message;
    private Object data;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
